<?php

class custom_form{
	
	function __construct(){
		
	}
	
	function input($type = 'text',$attribute){
		if(isset($attribute['action'])){
		$action = $attribute['action']['key']."='".$attribute['action']['val']."'";
		}
		switch($type){
			case "text" :				
				$form  = "<label>".$attribute['label']."<span class='red'>*</span></label> :";
				$form .= "<input type='text' ".$action." value='".$attribute['value']."' id='txt_".$attribute['id']."' class='".$attribute['class']."' name='txt_".$attribute['name']."'>";
				$form .= "<sup class='red error_txt_".$attribute['name']."'>* Required</sup>";				
			break;
			case "combo" :
				$form   = "<label>".$attribute['label']."<span class='red'>*</span></label> :";
   	  			$form  .= "<select class='".$attribute['class']."' id='".$attribute['id']."' name='".$attribute['name']."' $action>";
            	$form  .= "<option value='0'> --- PILIH --- </option>";
            	while (OCIFetchInto($attribute['value'],$r_company_list)) {
            		$form  .= "<option value='".$r_company_list[0]."' ".chekedValidation($r_company_list[0],$company)."> $r_company_list[2] </option>";
            	}
            	$form  .= "</select><sup class='red error_cmb_company hidden'> * Required </sup>";
			break;
			default :
			break;								
		}
		return $form;
	}
	
} 